package com.es.disped.dao.mapper;

import com.es.disped.dao.model.Course;
import com.es.disped.dao.model.CourseExample;
import java.util.List;

import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

/**
 * @author Anson<br>
 *	Copyright by EasyShare 2019<br>
 *  
 *  All right reserved<br>
 *
 *  Created on 2019年7月27日 下午8:45:42<br>
 *  名称：CourseMapper.java<br>
 *  描述：课程模型<br>
 */
//@CacheNamespace(implementation=(com.es.disped.dao.cache.RedisCache.class),size=512,flushInterval=60000)
public interface CourseMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @SelectProvider(type=CourseSqlProvider.class, method="countByExample")
    long countByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @DeleteProvider(type=CourseSqlProvider.class, method="deleteByExample")
    int deleteByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @Delete({
        "delete from course",
        "where course_id = #{courseId,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(String courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @Insert({
        "insert into course (course_id, course_name, ",
        "course_index, course_update_date, ",
        "course_valid)",
        "values (#{courseId,jdbcType=CHAR}, #{courseName,jdbcType=VARCHAR}, ",
        "#{courseIndex,jdbcType=INTEGER}, #{courseUpdateDate,jdbcType=VARCHAR}, ",
        "#{courseValid,jdbcType=INTEGER})"
    })
    int insert(Course record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @InsertProvider(type=CourseSqlProvider.class, method="insertSelective")
    int insertSelective(Course record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @SelectProvider(type=CourseSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="course_id", property="courseId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="course_name", property="courseName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_index", property="courseIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="course_update_date", property="courseUpdateDate", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_valid", property="courseValid", jdbcType=JdbcType.INTEGER)
    })
    List<Course> selectByExample(CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @Select({
        "select",
        "course_id, course_name, course_index, course_update_date, course_valid",
        "from course",
        "where course_id = #{courseId,jdbcType=CHAR}"
    })
    @Results({
        @Result(column="course_id", property="courseId", jdbcType=JdbcType.CHAR, id=true),
        @Result(column="course_name", property="courseName", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_index", property="courseIndex", jdbcType=JdbcType.INTEGER),
        @Result(column="course_update_date", property="courseUpdateDate", jdbcType=JdbcType.VARCHAR),
        @Result(column="course_valid", property="courseValid", jdbcType=JdbcType.INTEGER)
    })
    Course selectByPrimaryKey(String courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @UpdateProvider(type=CourseSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Course record, @Param("example") CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @UpdateProvider(type=CourseSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Course record, @Param("example") CourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @UpdateProvider(type=CourseSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Course record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table course
     *
     * @mbg.generated Wed Jul 03 00:14:42 CST 2019
     */
    @Update({
        "update course",
        "set course_name = #{courseName,jdbcType=VARCHAR},",
          "course_index = #{courseIndex,jdbcType=INTEGER},",
          "course_update_date = #{courseUpdateDate,jdbcType=VARCHAR},",
          "course_valid = #{courseValid,jdbcType=INTEGER}",
        "where course_id = #{courseId,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(Course record);
}